<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-CN">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />



  <meta name="google-site-verification" content="6Ik8pGDtBtOTGCKiPW_YXR0Wqp7FfhOllj0Bi92eBDo" />







  <meta name="baidu-site-verification" content="code-uIla4FKPmw" />







  
  
  <link href="/berlinblog/libs/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/berlinblog/libs/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/berlinblog/css/main.css?v=5.1.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Docker," />





  <link rel="alternate" href="/berlinblog/atom.xml" title="白叁木小肆" type="application/atom+xml" />




  <link rel="shortcut icon" type="image/x-icon" href="https://raw.githubusercontent.com/A-limon/pacman/master/source/img/favicon.ico?v=5.1.2" />






<meta name="description" content="概述2013年发布至今， Docker 一直广受瞩目，被认为可能会改变软件行业。 但是，许多人并不清楚 Docker 到底是什么，要解决什么问题，好处又在哪里？">
<meta property="og:type" content="article">
<meta property="og:title" content="Docker入门（转摘）">
<meta property="og:url" content="https://berlinwong.gitee.io/berlinblog/2021/09/01/Docker%20%E5%85%A5%E9%97%A8/index.html">
<meta property="og:site_name" content="白叁木小肆">
<meta property="og:description" content="概述2013年发布至今， Docker 一直广受瞩目，被认为可能会改变软件行业。 但是，许多人并不清楚 Docker 到底是什么，要解决什么问题，好处又在哪里？">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://berlinwong.gitee.io/berlinblog/imgs/Docker%20%E5%85%A5%E9%97%A8/header.png">
<meta property="article:published_time" content="2021-08-31T21:57:52.000Z">
<meta property="article:modified_time" content="2021-10-21T17:04:48.659Z">
<meta property="article:author" content="Berlin">
<meta property="article:tag" content="Docker">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://berlinwong.gitee.io/berlinblog/imgs/Docker%20%E5%85%A5%E9%97%A8/header.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '',
    scheme: 'Gemini',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":12,"b2t":true,"scrollpercent":true,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://berlinwong.gitee.io/berlinblog/2021/09/01/Docker 入门/"/>





  <title>Docker入门（转摘） | 白叁木小肆</title>
  














<meta name="generator" content="Hexo 5.4.0"></head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta custom-logo">
    

    <div class="custom-logo-site-title">
      <a href="/berlinblog/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">白叁木小肆</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">当一个快乐的码农吧！</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/berlinblog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/berlinblog/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            Tags
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/berlinblog/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            Categories
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/berlinblog/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            Archives
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/berlinblog/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            About
          </a>
        </li>
      
        
        <li class="menu-item menu-item-sitemap">
          <a href="/berlinblog/sitemap.xml" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-sitemap"></i> <br />
            
            Sitemap
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://berlinwong.gitee.io/berlinblog/berlinblog/2021/09/01/Docker%20%E5%85%A5%E9%97%A8/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/berlinblog/images/avatar.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="白叁木小肆">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Docker入门（转摘）</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2021-09-01T05:57:52+08:00">
                2021-09-01
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">In</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/berlinblog/categories/%E5%8E%9F%E7%90%86%E5%88%86%E6%9E%90/" itemprop="url" rel="index">
                    <span itemprop="name">原理分析</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          


          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p><img src="https://berlinwong.gitee.io/berlinblog/imgs/Docker%20%E5%85%A5%E9%97%A8/header.png" alt="header"></p>
<h2 id="概述"><a href="#概述" class="headerlink" title="概述"></a>概述</h2><p>2013年发布至今， <a target="_blank" rel="noopener" href="https://www.docker.com/">Docker</a> 一直广受瞩目，被认为可能会改变软件行业。</p>
<p>但是，许多人并不清楚 Docker 到底是什么，要解决什么问题，好处又在哪里？</p>
<span id="more"></span>

<h2 id="一、环境配置的难题"><a href="#一、环境配置的难题" class="headerlink" title="一、环境配置的难题"></a>一、环境配置的难题</h2><p>在现阶段软件开发的过程中，环境变量的配置实属让很多初学者也好，程序界大佬也好，都很头疼。比如一个项目在自己的电脑环境里可以完美运行，但是到其他的机器上错误百出，需要配置这个环境哪个环境，就拿Python来讲，安装一个Python应用，得有Python环境，还得有各种库，对于不同的项目可能需要的库也不同。那么我如果换一台PC，又得重头再来，而且有的版本之间的兼容问题会导致很麻烦的冲突。在这种情况下，能不能有一种机制，能够把本地的环境和软件一起带过来，到另一台设备上直接连环境安装。</p>
<h2 id="二、虚拟机"><a href="#二、虚拟机" class="headerlink" title="二、虚拟机"></a>二、虚拟机</h2><p>虚拟机（virtual machine）就是带环境安装的一种解决方案。它可以在一种操作系统里面运行另一种操作系统，比如在 Windows 系统里面运行 Linux 系统。应用程序对此毫无感知，因为虚拟机看上去跟真实系统一模一样，而<strong>对于底层系统来说，虚拟机就是一个普通文件，不需要了就删掉，对其他部分毫无影响。</strong></p>
<p>虽然用户可以通过虚拟机还原软件的原始环境。但是，这个方案有几个缺点。</p>
<p><strong>（1）资源占用多</strong></p>
<p>虚拟机会独占一部分内存和硬盘空间。它运行的时候，其他程序就不能使用这些资源了。哪怕虚拟机里面的应用程序，真正使用的内存只有 1MB，虚拟机依然需要几百 MB 的内存才能运行。</p>
<p><strong>（2）冗余步骤多</strong></p>
<p>虚拟机是完整的操作系统，一些系统级别的操作步骤，往往无法跳过，比如用户登录。</p>
<p><strong>（3）启动慢</strong></p>
<p>启动操作系统需要多久，启动虚拟机就需要多久。可能要等几分钟，应用程序才能真正运行。</p>
<h2 id="三、Linux-容器"><a href="#三、Linux-容器" class="headerlink" title="三、Linux 容器"></a>三、Linux 容器</h2><p>由于虚拟机存在这些缺点，<strong>Linux 发展出了另一种虚拟化技术：Linux 容器（Linux Containers，缩写为 LXC）</strong>。</p>
<p><strong>Linux 容器不是模拟一个完整的操作系统，而是对进程进行隔离。</strong>或者说，在正常进程的外面套了一个<a target="_blank" rel="noopener" href="https://opensource.com/article/18/1/history-low-level-container-runtimes">保护层</a>。对于容器里面的进程来说，它接触到的各种资源都是虚拟的，从而实现与底层系统的隔离。</p>
<p>由于容器是进程级别的，相比虚拟机有很多优势。</p>
<p><strong>（1）启动快</strong></p>
<p><strong>容器里面的应用，直接就是底层系统的一个进程，而不是虚拟机内部的进程。所以，启动容器相当于启动本机的一个进程</strong>，而不是启动一个操作系统，速度就快很多。</p>
<p><strong>（2）资源占用少</strong></p>
<p>容器只占用需要的资源，不占用那些没有用到的资源；虚拟机由于是完整的操作系统，不可避免要占用所有资源。另外，<strong>多个容器可以共享资源</strong>，虚拟机都是独享资源。</p>
<p><strong>（3）体积小</strong></p>
<p>容器只要包含用到的组件即可，而虚拟机是整个操作系统的打包，所以容器文件比虚拟机文件要小很多。</p>
<p>总之，容器有点像轻量级的虚拟机，能够提供虚拟化的环境，但是成本开销小得多。</p>
<h2 id="四、Docker-是什么？"><a href="#四、Docker-是什么？" class="headerlink" title="四、Docker 是什么？"></a>四、Docker 是什么？</h2><p><strong>Docker 属于 Linux 容器的一种封装，提供简单易用的容器使用接口。</strong>它是目前最流行的 Linux 容器解决方案。</p>
<p><strong>Docker 将应用程序与该程序的依赖，打包在一个文件里面。运行这个文件，就会生成一个虚拟容器。程序在这个虚拟容器里运行，就好像在真实的物理机上运行一样。有了 Docker，就不用担心环境问题。</strong></p>
<p>总体来说，Docker 的接口相当简单，用户可以方便地创建和使用容器，把自己的应用放入容器。容器还可以进行版本管理、复制、分享、修改，就像管理普通的代码一样。</p>
<h2 id="五、Docker-的用途"><a href="#五、Docker-的用途" class="headerlink" title="五、Docker 的用途"></a>五、Docker 的用途</h2><p>Docker 的主要用途，目前有三大类。</p>
<p><strong>（1）提供一次性的环境。</strong>比如，本地测试他人的软件、持续集成的时候提供单元测试和构建的环境。</p>
<p><strong>（2）提供弹性的云服务。</strong>因为 Docker 容器可以随开随关，很适合动态扩容和缩容。</p>
<p><strong>（3）组建微服务架构。</strong>通过多个容器，一台机器可以跑多个服务，因此在本机就可以模拟出微服务架构。</p>
<h2 id="六、Docker-的安装"><a href="#六、Docker-的安装" class="headerlink" title="六、Docker 的安装"></a>六、Docker 的安装</h2><p>Docker 是一个开源的商业产品，有两个版本：<strong>社区版（Community Edition，缩写为 CE）</strong>和企业版（Enterprise Edition，缩写为 EE）。企业版包含了一些收费服务，个人开发者一般用不到。下面的介绍都针对社区版。</p>
<p>Docker CE 的安装请参考官方文档。</p>
<ul>
<li><a target="_blank" rel="noopener" href="https://docs.docker.com/docker-for-mac/install/">Mac</a></li>
<li><a target="_blank" rel="noopener" href="https://docs.docker.com/docker-for-windows/install/">Windows</a></li>
<li><a target="_blank" rel="noopener" href="https://docs.docker.com/install/linux/docker-ce/ubuntu/">Ubuntu</a></li>
<li><a target="_blank" rel="noopener" href="https://docs.docker.com/install/linux/docker-ce/debian/">Debian</a></li>
<li><a target="_blank" rel="noopener" href="https://docs.docker.com/install/linux/docker-ce/centos/">CentOS</a></li>
<li><a target="_blank" rel="noopener" href="https://docs.docker.com/install/linux/docker-ce/fedora/">Fedora</a></li>
<li><a target="_blank" rel="noopener" href="https://docs.docker.com/install/linux/docker-ce/binaries/">其他 Linux 发行版</a></li>
</ul>
<p>安装完成后，运行下面的命令，验证是否安装成功。</p>
<blockquote>
<p>$ docker version # 或者 $ docker info</p>
</blockquote>
<p><strong>Docker 需要用户具有 sudo 权限，为了避免每次命令都输入<code>sudo</code>，可以把用户加入 Docker 用户组（<a target="_blank" rel="noopener" href="https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user">官方文档</a>）</strong>。</p>
<blockquote>
<p><strong>$ sudo usermod -aG docker $USER</strong></p>
</blockquote>
<p>Docker 是服务器—-客户端架构。命令行运行<code>docker</code>命令的时候，需要本机有 Docker 服务。如果这项服务没有启动，可以用下面的命令启动（<a target="_blank" rel="noopener" href="https://docs.docker.com/config/daemon/systemd/">官方文档</a>）。</p>
<blockquote>
<p># service 命令的用法<br>$ sudo service docker start</p>
<p># systemctl 命令的用法<br>$ sudo systemctl start docker</p>
</blockquote>
<h2 id="六、image-文件"><a href="#六、image-文件" class="headerlink" title="六、image 文件"></a>六、image 文件</h2><p><strong>Docker 把应用程序及其依赖，打包在 image 文件里面。</strong>只有通过这个文件，才能生成 Docker 容器。image 文件可以看作是容器的模板。Docker 根据 image 文件生成容器的实例。同一个 image 文件，可以生成多个同时运行的容器实例。</p>
<p>image 是二进制文件。实际开发中，一个 image 文件往往通过继承另一个 image 文件，加上一些个性化设置而生成。举例来说，你可以在 Ubuntu 的 image 基础上，往里面加入 Apache 服务器，形成你的 image。</p>
<blockquote>
<p># 列出本机的所有 image 文件。<br>$ <strong>docker image ls</strong></p>
<p># 删除 image 文件<br>$ docker image rm [imageName]</p>
</blockquote>
<p>image 文件是通用的，一台机器的 image 文件拷贝到另一台机器，照样可以使用。一般来说，为了节省时间，我们应该尽量使用别人制作好的 image 文件，而不是自己制作。即使要定制，也应该基于别人的 image 文件进行加工，而不是从零开始制作。</p>
<p>为了方便共享，image 文件制作完成后，可以上传到网上的仓库。<strong>Docker 的官方仓库 <a target="_blank" rel="noopener" href="https://hub.docker.com/">Docker Hub</a> 是最重要、最常用的 image 仓库</strong>。此外，出售自己制作的 image 文件也是可以的。</p>
<h2 id="七、实例：hello-world"><a href="#七、实例：hello-world" class="headerlink" title="七、实例：hello world"></a>七、实例：hello world</h2><p>下面，我们通过最简单的 image 文件”<a target="_blank" rel="noopener" href="https://hub.docker.com/r/library/hello-world/">hello world”</a>，感受一下 Docker。</p>
<p>需要说明的是，国内连接 Docker 的官方仓库很慢，还会断线，<strong>需要将默认仓库改成国内的镜像网站</strong>，具体的修改方法在<a target="_blank" rel="noopener" href="http://www.ruanyifeng.com/blog/2018/02/docker-wordpress-tutorial.html">下一篇文章</a>的第一节。有需要的朋友，可以先看一下。</p>
<p>首先，运行下面的命令，将 image 文件从仓库抓取到本地。</p>
<blockquote>
<p>$ docker image pull library/hello-world</p>
</blockquote>
<p>上面代码中，**<code>docker image pull</code>是抓取 image 文件的命令**。<code>library/hello-world</code>是 image 文件在仓库里面的位置，其中<code>library</code>是 image 文件所在的组，<code>hello-world</code>是 image 文件的名字。</p>
<p>由于 Docker 官方提供的 image 文件，都放在<code>library</code>组里面，所以它的是默认组，可以省略。因此，上面的命令可以写成下面这样。</p>
<blockquote>
<p>$ docker image pull hello-world</p>
</blockquote>
<p>抓取成功以后，就可以在本机看到这个 image 文件了。</p>
<blockquote>
<p>$ docker image ls</p>
</blockquote>
<p>现在，运行这个 image 文件。</p>
<blockquote>
<p>$ docker container run hello-world</p>
</blockquote>
<p><strong><code>docker container run</code>命令会从 image 文件，生成一个正在运行的容器实例。</strong></p>
<p>注意，<code>docker container run</code>命令具有自动抓取 image 文件的功能。如果发现本地没有指定的 image 文件，就会从仓库自动抓取。因此，前面的<code>docker image pull</code>命令并不是必需的步骤。</p>
<p>如果运行成功，你会在屏幕上读到下面的输出。</p>
<blockquote>
<p>$ docker container run hello-world Hello from Docker! This message shows that your installation appears to be working correctly. … …</p>
</blockquote>
<p>输出这段提示以后，<code>hello world</code>就会停止运行，容器自动终止。</p>
<p>有些容器不会自动终止，因为提供的是服务。比如，安装运行 Ubuntu 的 image，就可以在命令行体验 Ubuntu 系统。</p>
<blockquote>
<p>$ docker container run -it ubuntu bash</p>
</blockquote>
<p><strong>对于那些不会自动终止的容器，必须使用<code>docker container kill</code></strong> 命令手动终止。</p>
<blockquote>
<p>$ docker container kill [containID]</p>
</blockquote>
<h2 id="八、容器文件"><a href="#八、容器文件" class="headerlink" title="八、容器文件"></a>八、容器文件</h2><p><strong>image 文件生成的容器实例，本身也是一个文件，称为容器文件。</strong>也就是说，一旦容器生成，就会同时存在两个文件： image 文件和容器文件。而且关闭容器并不会删除容器文件，只是容器停止运行而已。</p>
<blockquote>
<p><strong># 列出本机正在运行的容器</strong><br><strong>$ docker container ls</strong></p>
<p><strong># 列出本机所有容器，包括终止运行的容器</strong><br><strong>$ docker container ls –all</strong></p>
</blockquote>
<p>上面命令的输出结果之中，包括容器的 ID。很多地方都需要提供这个 ID，比如上一节终止容器运行的<code>docker container kill</code>命令。</p>
<p>终止运行的容器文件，依然会占据硬盘空间，可以使用<code>docker container rm</code>命令删除。</p>
<blockquote>
<p>$ docker container rm [containerID]</p>
</blockquote>
<p>运行上面的命令之后，再使用<code>docker container ls --all</code>命令，就会发现被删除的容器文件已经消失了。</p>
<h2 id="九、总结"><a href="#九、总结" class="headerlink" title="九、总结"></a>九、总结</h2><p>根据上述描述，我写了下面的快捷查询手册：</p>
<h3 id="基本运行指令"><a href="#基本运行指令" class="headerlink" title="基本运行指令"></a>基本运行指令</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 启动和停止容器</span></span><br><span class="line">docker start ID</span><br><span class="line">docker restart ID</span><br><span class="line">docker stop ID</span><br><span class="line">docker <span class="built_in">kill</span> ID</span><br></pre></td></tr></table></figure>

<h3 id="查看镜像"><a href="#查看镜像" class="headerlink" title="查看镜像"></a>查看镜像</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">┌──(berlin@Berlin-BOOK)-[~]</span><br><span class="line">└─$ sudo docker images                                                                                                                                                                       1 ⨯</span><br><span class="line">[sudo] berlin 的密码：</span><br><span class="line">REPOSITORY    TAG       IMAGE ID       CREATED        SIZE</span><br><span class="line">hello-world   latest    d1165f221234   3 months ago   13.3kB             </span><br></pre></td></tr></table></figure>

<h3 id="Docker-内置指令"><a href="#Docker-内置指令" class="headerlink" title="Docker 内置指令"></a>Docker 内置指令</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">docker version</span><br><span class="line">docker info</span><br><span class="line">docker </span><br><span class="line">docker --<span class="built_in">help</span></span><br></pre></td></tr></table></figure>

<h3 id="镜像相关指令"><a href="#镜像相关指令" class="headerlink" title="镜像相关指令"></a>镜像相关指令</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">docker images</span><br><span class="line"></span><br><span class="line">docker search</span><br><span class="line">可选项： --filter=STARS=3000 #STARS大于3000的镜像</span><br><span class="line"></span><br><span class="line">docker pull # 下载镜像 docker分层下载 签名 真实地址</span><br><span class="line"></span><br><span class="line">docker rmi -f IMAGEID #删除指定容器</span><br><span class="line">docker rmi -f IMAGEID IMAGEID IMAGEID #删除多个容器</span><br><span class="line">docker rmi -f $(docker images -aq) # 递归删除</span><br></pre></td></tr></table></figure>

<h3 id="容器相关指令"><a href="#容器相关指令" class="headerlink" title="容器相关指令"></a>容器相关指令</h3><h4 id="下载Centos镜像"><a href="#下载Centos镜像" class="headerlink" title="下载Centos镜像"></a>下载Centos镜像</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker pull centos</span><br></pre></td></tr></table></figure>

<h4 id="创建容器并启动"><a href="#创建容器并启动" class="headerlink" title="创建容器并启动"></a>创建容器并启动</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">docker run [...] image</span><br><span class="line"><span class="meta">#</span><span class="bash"> 参数说明</span></span><br><span class="line">-- name=&quot;Name&quot;</span><br><span class="line">-d     # 后台运行</span><br><span class="line">-it    # 交互方式运行</span><br><span class="line">-p     # 指定端口</span><br><span class="line">			-p  ip:主机端口:容器端口</span><br><span class="line">			-p 主机端口:容器端口(常用)</span><br><span class="line">			-p 容器端口</span><br><span class="line">			端口地址</span><br><span class="line">-P     # 随机指定端口</span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="comment"># Eg. 启动centos</span></span></span><br><span class="line">┌──(root@Berlin-BOOK)-[/home/berlin]</span><br><span class="line">└─# docker run -it centos /bin/bash</span><br><span class="line"></span><br><span class="line">[root@645cb5842a1a /]# ls</span><br><span class="line">bin  dev  etc  home  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 退回主机</span></span><br><span class="line">[root@645cb5842a1a /]# exit</span><br><span class="line">exit      </span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 退出容器 <span class="built_in">exit</span></span></span><br><span class="line">CTRL + P + Q #容器不停止退出</span><br></pre></td></tr></table></figure>

<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 查看当前运行的镜像</span></span><br><span class="line">└─<span class="comment"># docker ps                      </span></span><br><span class="line">CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES</span><br><span class="line">          </span><br><span class="line"><span class="comment"># docker ps -a 曾经运行过的</span></span><br><span class="line"><span class="comment"># -n=[] 最近创建的容器</span></span><br><span class="line"><span class="comment"># -q 只显示容器的编号</span></span><br><span class="line"></span><br><span class="line">┌──(root@Berlin-BOOK)-[/home/berlin]</span><br><span class="line">└─<span class="comment"># docker ps -a</span></span><br><span class="line">CONTAINER ID   IMAGE          COMMAND       CREATED          STATUS                      PORTS     NAMES</span><br><span class="line">645cb5842a1a   centos         <span class="string">&quot;/bin/bash&quot;</span>   13 minutes ago   Exited (0) 11 minutes ago             focused_hamilton</span><br><span class="line">c03c586491e8   d1165f221234   <span class="string">&quot;/hello&quot;</span>      2 hours ago      Exited (0) 2 hours ago                vigorous_engelbart</span><br></pre></td></tr></table></figure>

<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 删除容器</span></span><br><span class="line">docker rm 容器ID</span><br><span class="line">docker rm -f $(docker ps -aq) <span class="comment">#递归删除容器 -f 强制删除</span></span><br><span class="line">docker ps -a -q|xargs docker</span><br></pre></td></tr></table></figure>

<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 启动和停止容器</span></span><br><span class="line">docker start ID</span><br><span class="line">docker restart ID</span><br><span class="line">docker stop ID</span><br><span class="line">docker <span class="built_in">kill</span> ID</span><br></pre></td></tr></table></figure>



<h3 id="常用其他指令"><a href="#常用其他指令" class="headerlink" title="常用其他指令"></a>常用其他指令</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> 后台运行</span></span><br><span class="line">docker run -d centos # ps查看时会发现并没有进程，因为docker在容器没有前台服务时，自动停止</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 查看日志</span></span><br><span class="line">docker logs -tf --tail 10 ID</span><br><span class="line"><span class="meta">#</span><span class="bash"> tail 后面要加条数 显示指定行数</span></span><br><span class="line"><span class="meta">#</span><span class="bash"> tail 可以用 -n 代替</span></span><br><span class="line"><span class="meta">#</span><span class="bash"> f 持续显示日志</span></span><br><span class="line"><span class="meta">#</span><span class="bash"> t 带时间戳</span></span><br><span class="line">-------------------------------------------------------------------------------</span><br><span class="line">└─# docker run -d centos /bin/sh -c &quot;while true;do echo berlin;sleep 1;done&quot; </span><br><span class="line">f66cd3e9aeb7d62aec273511576f8b0e54962024c90518d12a8b8fce9b545662</span><br><span class="line">                                                                                                                                                                                                 </span><br><span class="line">┌──(root@Berlin-BOOK)-[/home/berlin]</span><br><span class="line">└─# docker ps                                                               </span><br><span class="line">CONTAINER ID   IMAGE     COMMAND                  CREATED         STATUS         PORTS     NAMES</span><br><span class="line">f66cd3e9aeb7   centos    &quot;/bin/sh -c &#x27;while t…&quot;   7 seconds ago   Up 6 seconds             elegant_galileo</span><br><span class="line">                                                                                                                                                                                                 </span><br><span class="line">┌──(root@Berlin-BOOK)-[/home/berlin]</span><br><span class="line">└─# docker logs -f -t --tail 10 f66cd3e9aeb7 2021-06-14T13:34:22.097767109Z berlin</span><br><span class="line">2021-06-14T13:34:23.101832198Z berlin</span><br><span class="line">2021-06-14T13:34:24.105838947Z berlin</span><br><span class="line">2021-06-14T13:34:25.109940648Z berlin</span><br><span class="line">2021-06-14T13:34:26.113648755Z berlin</span><br><span class="line">2021-06-14T13:34:27.115549552Z berlin</span><br><span class="line">2021-06-14T13:34:28.119678858Z berlin</span><br><span class="line">2021-06-14T13:34:29.124127443Z berlin</span><br><span class="line">2021-06-14T13:34:30.128461303Z berlin</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 查看docker内部进程信息</span></span><br><span class="line">docker top ID</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> docker inspect ID <span class="comment">#查看当前容器所有信息</span></span></span><br><span class="line">进入docker容器进行操作</span><br><span class="line"><span class="meta">#</span><span class="bash"> docker <span class="built_in">exec</span> -it ID /bin/sh</span>  </span><br><span class="line"><span class="meta">#</span><span class="bash"> docker attach ID</span></span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 文件从docker 拷贝到本机</span></span><br><span class="line">docker cp ID:容器路径 本机路径</span><br><span class="line">┌──(root@Berlin-BOOK)-[/]</span><br><span class="line">└─# docker cp 20226d3abe30:/home/test.java /home/berlin/桌面</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h3 id="Elasticsearch"><a href="#Elasticsearch" class="headerlink" title="Elasticsearch"></a>Elasticsearch</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> docker stats  查看当前资源占用</span></span><br><span class="line">-e 环境配置修改 -e ES_JAVA_OPTS=&quot;-Xms64m -Xmx512m&quot;</span><br></pre></td></tr></table></figure>

<h3 id="使用-数据卷"><a href="#使用-数据卷" class="headerlink" title="使用 数据卷"></a>使用 数据卷</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">方式一：直接使用命令挂载 docker run -it -v [/home/test:/home]</span><br><span class="line"></span><br><span class="line">权限问题会导致目录为空，如何解决呢？暂时未解决 </span><br><span class="line">chmod 777 /home/test</span><br></pre></td></tr></table></figure>


      
    </div>
    
    
    
    
      <div style="text-align:center;color: #634db5;font-size:12px;">
-------------  本文结束 <i class="fa fa-cog fa-spin fa-1x fa-fw"></i> 感谢阅读  -------------
</div>

    
    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/berlinblog/tags/Docker/" rel="tag"><i class="fa fa-tag"></i> Docker</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/berlinblog/2021/08/29/facetime2/" rel="next" title="安硕信息复面">
                <i class="fa fa-chevron-left"></i> 安硕信息复面
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/berlinblog/2021/09/02/offer/" rel="prev" title="第一份 Offer，我有话说">
                第一份 Offer，我有话说 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            Overview
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/berlinblog/images/avatar.png"
               alt="" />
          <p class="site-author-name" itemprop="name"></p>
           
              <p class="site-description motion-element" itemprop="description"></p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/berlinblog/archives/">
                <span class="site-state-item-count">17</span>
                <span class="site-state-item-name">posts</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/berlinblog/categories/index.html">
                <span class="site-state-item-count">4</span>
                <span class="site-state-item-name">categories</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/berlinblog/tags/index.html">
                <span class="site-state-item-count">17</span>
                <span class="site-state-item-name">tags</span>
              </a>
            </div>
          

        </nav>

        
          <div class="feed-link motion-element">
            <a href="/berlinblog/atom.xml" rel="alternate">
              <i class="fa fa-rss"></i>
              RSS
            </a>
          </div>
        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://gitee.com/berlinwong" target="_blank" title="Gitee">
                  
                    <i class="fa fa-fw fa-git"></i>
                  
                    
                      Gitee
                    
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="wzysws@gmail.com" target="_blank" title="E-Mail">
                  
                    <i class="fa fa-fw fa-envelope"></i>
                  
                    
                      E-Mail
                    
                </a>
              </span>
            
          
        </div>

        
        
          <div class="cc-license motion-element" itemprop="license">
            <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" target="_blank">
              <img src="/berlinblog/images/cc-by-nc-sa.svg" alt="Creative Commons" />
            </a>
          </div>
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%A6%82%E8%BF%B0"><span class="nav-number">1.</span> <span class="nav-text">概述</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%B8%80%E3%80%81%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE%E7%9A%84%E9%9A%BE%E9%A2%98"><span class="nav-number">2.</span> <span class="nav-text">一、环境配置的难题</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BA%8C%E3%80%81%E8%99%9A%E6%8B%9F%E6%9C%BA"><span class="nav-number">3.</span> <span class="nav-text">二、虚拟机</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%B8%89%E3%80%81Linux-%E5%AE%B9%E5%99%A8"><span class="nav-number">4.</span> <span class="nav-text">三、Linux 容器</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%9B%9B%E3%80%81Docker-%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F"><span class="nav-number">5.</span> <span class="nav-text">四、Docker 是什么？</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BA%94%E3%80%81Docker-%E7%9A%84%E7%94%A8%E9%80%94"><span class="nav-number">6.</span> <span class="nav-text">五、Docker 的用途</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%85%AD%E3%80%81Docker-%E7%9A%84%E5%AE%89%E8%A3%85"><span class="nav-number">7.</span> <span class="nav-text">六、Docker 的安装</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%85%AD%E3%80%81image-%E6%96%87%E4%BB%B6"><span class="nav-number">8.</span> <span class="nav-text">六、image 文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%B8%83%E3%80%81%E5%AE%9E%E4%BE%8B%EF%BC%9Ahello-world"><span class="nav-number">9.</span> <span class="nav-text">七、实例：hello world</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%85%AB%E3%80%81%E5%AE%B9%E5%99%A8%E6%96%87%E4%BB%B6"><span class="nav-number">10.</span> <span class="nav-text">八、容器文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%B9%9D%E3%80%81%E6%80%BB%E7%BB%93"><span class="nav-number">11.</span> <span class="nav-text">九、总结</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%9F%BA%E6%9C%AC%E8%BF%90%E8%A1%8C%E6%8C%87%E4%BB%A4"><span class="nav-number">11.1.</span> <span class="nav-text">基本运行指令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%9F%A5%E7%9C%8B%E9%95%9C%E5%83%8F"><span class="nav-number">11.2.</span> <span class="nav-text">查看镜像</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Docker-%E5%86%85%E7%BD%AE%E6%8C%87%E4%BB%A4"><span class="nav-number">11.3.</span> <span class="nav-text">Docker 内置指令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E9%95%9C%E5%83%8F%E7%9B%B8%E5%85%B3%E6%8C%87%E4%BB%A4"><span class="nav-number">11.4.</span> <span class="nav-text">镜像相关指令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%AE%B9%E5%99%A8%E7%9B%B8%E5%85%B3%E6%8C%87%E4%BB%A4"><span class="nav-number">11.5.</span> <span class="nav-text">容器相关指令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E4%B8%8B%E8%BD%BDCentos%E9%95%9C%E5%83%8F"><span class="nav-number">11.5.1.</span> <span class="nav-text">下载Centos镜像</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%88%9B%E5%BB%BA%E5%AE%B9%E5%99%A8%E5%B9%B6%E5%90%AF%E5%8A%A8"><span class="nav-number">11.5.2.</span> <span class="nav-text">创建容器并启动</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%B8%B8%E7%94%A8%E5%85%B6%E4%BB%96%E6%8C%87%E4%BB%A4"><span class="nav-number">11.6.</span> <span class="nav-text">常用其他指令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Elasticsearch"><span class="nav-number">11.7.</span> <span class="nav-text">Elasticsearch</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BD%BF%E7%94%A8-%E6%95%B0%E6%8D%AE%E5%8D%B7"><span class="nav-number">11.8.</span> <span class="nav-text">使用 数据卷</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      
        <div class="back-to-top">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-ravelry"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Berlin</span>
</div>



        

        
      </div>
    </footer>

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/berlinblog/libs/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/berlinblog/libs/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/berlinblog/libs/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/berlinblog/libs/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/berlinblog/libs/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/berlinblog/libs/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/berlinblog/js/src/utils.js?v=5.1.2"></script>

  <script type="text/javascript" src="/berlinblog/js/src/motion.js?v=5.1.2"></script>



  
  


  <script type="text/javascript" src="/berlinblog/js/src/affix.js?v=5.1.2"></script>

  <script type="text/javascript" src="/berlinblog/js/src/schemes/pisces.js?v=5.1.2"></script>



  
  <script type="text/javascript" src="/berlinblog/js/src/scrollspy.js?v=5.1.2"></script>
<script type="text/javascript" src="/berlinblog/js/src/post-details.js?v=5.1.2"></script>



  


  <script type="text/javascript" src="/berlinblog/js/src/bootstrap.js?v=5.1.2"></script>



  


  




	





  





  






  





  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  

  

  

  

</body>
</html>
